<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function createComparisonFunction(propertyName) {
            return function (object1, object2) {
                var value1 = object1[propertyName]
                var value2 = object2[propertyName]
                if (value1 < value2) {
                    return -1
                } else if (value1 > value2) {
                    return 2
                } else {
                    return 0
                }
            }
        }
        var compareNames = createComparisonFunction('name')
        var result = compareNames({ name: 'zwj' }, { name: 'fuck' })

        var name = 'window'
        var obj = {
            name: 'obj',
            sayName: function () {
                var that = this
                return function () {
                    console.log(that.name)
                }
            }
        }
        obj.sayName()()
    </script>
</body>

</html>